import java.util.Scanner;
import java.io.*;

public class Validator
{
	private static final String INPUT_FILE = "drew_out.txt";
	
	private static int heuristic = 0;
	private static int[] seniorChoices = new int[7];
	private static int[] juniorChoices = new int[7];
	private static int[] sophomoreChoices = new int[7];
	private static int[] freshmanChoices = new int[7];
	private static int[] lateChoices = new int[7];
	
	public static void main(String[] args)
	{
		for (int i = 0; i < seniorChoices.length; i++)
		{
			seniorChoices[i] = 0;
		}
		for (int i = 0; i < juniorChoices.length; i++)
		{
			juniorChoices[i] = 0;
		}
		for (int i = 0; i < sophomoreChoices.length; i++)
		{
			sophomoreChoices[i] = 0;
		}
		for (int i = 0; i < freshmanChoices.length; i++)
		{
			freshmanChoices[i] = 0;
		}
		for (int i = 0; i < lateChoices.length; i++)
		{
			lateChoices[i] = 0;
		}
		
		readInData(INPUT_FILE);
		printResults();
	}
	
	private static void readInData(String infile)
	{
		Scanner s = null;
		try
		{
			s = new Scanner(new BufferedReader(new FileReader(infile)));
			while (s.hasNext())
			{
				String[] line = s.nextLine().split(",");
				String grade = line[0];
				int choice = Integer.parseInt(line[1]);
				boolean isLate = line[2].equalsIgnoreCase("true");
				if (!isLate)
				{
					if (grade.equals("SENIOR"))
					{
						seniorChoices[choice - 1]++;
						heuristic += choice * 12;
					}
					else if (grade.equals("JUNIOR"))
					{
						juniorChoices[choice - 1]++;
						heuristic += choice * 11;
					}
					else if (grade.equals("SOPHOMORE"))
					{
						sophomoreChoices[choice - 1]++;
						heuristic += choice * 10;

					}
					else if (grade.equals("FRESHMAN"))
					{
						freshmanChoices[choice - 1]++;
						heuristic += choice * 9;
					}
				}
				else
				{
					heuristic += choice * 6;
					lateChoices[choice - 1]++;
				}
			}
		}
		catch (FileNotFoundException e)
		{
			
		}
		finally
		{
			if (s != null)
			{
				s.close();
			}
		}
	}
	
	private static void printResults()
	{
		System.out.println("Heuristic: " + heuristic);
		System.out.println("Total Choices: ");
		for (int i = 0; i < 7; i++)
		{
			System.out.println("\t#" + (i + 1) + ":  " + (sumChoices(i)));
		}
		System.out.println();
		System.out.println("Senior choices: ");
		for (int i = 0; i < 7; i++)
		{
			System.out.println("\t#" + (i + 1) + ":  " + (seniorChoices[i]));
		}
		
		System.out.println();
		System.out.println("Junior choices: ");
		for (int i = 0; i < 7; i++)
		{
			System.out.println("\t#" + (i + 1) + ":  " + (juniorChoices[i]));
		}
		
		System.out.println();
		System.out.println("Sophomore choices: ");
		for (int i = 0; i < 7; i++)
		{
			System.out.println("\t#" + (i + 1) + ":  " + (sophomoreChoices[i]));
		}
		
		System.out.println();
		System.out.println("Freshman choices: ");
		for (int i = 0; i < 7; i++)
		{
			System.out.println("\t#" + (i + 1) + ":  " + (freshmanChoices[i]));
		}
		
		System.out.println();
		System.out.println("Late choices: ");
		for (int i = 0; i < 7; i++)
		{
			System.out.println("\t#" + (i + 1) + ":  " + (lateChoices[i]));
		}
	}
	
	private static int sumChoices(int choice)
	{
		int val = seniorChoices[choice];
		val += juniorChoices[choice];
		val += sophomoreChoices[choice];
		val += freshmanChoices[choice];
		val += lateChoices[choice];
		return val;
	}
}
